package com.itheima.网络编程.tcp编程.tcp编程.tcp网络编程;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class 图片服务端 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket accept = ss.accept();
        BufferedInputStream bis = new BufferedInputStream(accept.getInputStream());
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("day16 网络编程\\jieshou.txt"));
        byte[] bys = new byte[1024];
        int len;
        while ((len = bis.read(bys)) != -1) {
            bos.write(bys, 0, len);
            bos.flush();
        }
        System.out.println("==============================");
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("接收成功");
        bw.flush();
        bw.close();
        bos.close();
        bis.close();
        accept.close();
        ss.close();

    }
}
